cmake_minimum_required(VERSION 3.5)

project(Imgui VERSION 0.1 LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

include_directories(3rd/imgui)
include_directories(3rd/imgui/backends)
include_directories(3rd/glfw/include)

set(IMGUI_FILES
    ${CMAKE_SOURCE_DIR}/3rd/imgui/imgui.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/imgui_tables.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/imgui_draw.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/imgui_widgets.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/imgui_demo.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/backends/imgui_impl_glfw.cpp
    ${CMAKE_SOURCE_DIR}/3rd/imgui/backends/imgui_impl_opengl3.cpp
)
# file(GLOB IMGUI_FILES "${CMAKE_SOURCE_DIR}/3rd/imgui/*.cpp") # 获取所有cpp文件

if (MSVC)
    add_compile_options(/source-charset:utf-8)
    add_compile_options(/EHsc)
    add_compile_options(/wd4267)
    add_compile_options(-D_CRT_SECURE_NO_WARNINGS)
endif()

add_executable(ImguiDemo demo.cpp ${IMGUI_FILES})
add_executable(Imgui main.cpp ${IMGUI_FILES})
target_link_directories(ImguiDemo PRIVATE ${CMAKE_SOURCE_DIR}/3rd/glfw/lib)
target_link_directories(Imgui PRIVATE ${CMAKE_SOURCE_DIR}/3rd/glfw/lib)
target_link_libraries(ImguiDemo PRIVATE 
    debug glfw3D
    optimized glfw3 OpenGL32
)
target_link_libraries(Imgui PRIVATE 
    debug glfw3D
    optimized glfw3 OpenGL32
)